<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      NFS-Utils-2.4.3
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-9.1">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 9.1
      </h4>
      <h3>
        Chapter&nbsp;15.&nbsp;Networking Programs
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="net-tools.html" title=
          "Net-tools-CVS_20101030">Prev</a>
          <p>
            Net-tools-CVS_20101030
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="netfs.html" title=
          "Configuring for Network Filesystems">Next</a>
          <p>
            Configuring for Network Filesystems
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="netprogs.html" title=
          "Chapter&nbsp;15.&nbsp;Networking Programs">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="nfs-utils" name="nfs-utils"></a>NFS-Utils-2.4.3
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to NFS Utilities
        </h2>
        <p>
          The <span class="application">NFS Utilities</span> package contains
          the userspace server and client tools necessary to use the kernel's
          NFS abilities. NFS is a protocol that allows sharing file systems
          over the network.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "https://www.kernel.org/pub/linux/utils/nfs-utils/2.4.3/nfs-utils-2.4.3.tar.xz">
                https://www.kernel.org/pub/linux/utils/nfs-utils/2.4.3/nfs-utils-2.4.3.tar.xz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 06020c76f531ed97f3145514901e0e7c
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 670 KB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 20 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: 0.2 SBU
              </p>
            </li>
          </ul>
        </div>
        <h3>
          NFS Utilities Dependencies
        </h3>
        <h4>
          Required
        </h4>
        <p class="required">
          <a class="xref" href="libtirpc.html" title=
          "libtirpc-1.2.5">libtirpc-1.2.5</a>, <a class="xref" href=
          "rpcsvc-proto.html" title="rpcsvc-proto-1.4">rpcsvc-proto-1.4</a>
        </p>
        <h4>
          Optional
        </h4>
        <p class="optional">
          <a class="xref" href="../postlfs/lvm2.html" title=
          "LVM2-2.03.08">LVM2-2.03.08</a> (libdevmapper for NFSv4 support),
          <a class="xref" href="../general/libnfsidmap.html" title=
          "libnfsidmap-0.26">libnfsidmap-0.26</a> (for NFSv4 support),
          <a class="xref" href="libnsl.html" title=
          "libnsl-1.2.0">libnsl-1.2.0</a> (for NIS client support), <a class=
          "xref" href="../server/sqlite.html" title=
          "SQLite-3.31.1">SQLite-3.31.1</a>, <a class="xref" href=
          "../postlfs/mitkrb.html" title="MIT Kerberos V5-1.18">MIT Kerberos
          V5-1.18</a> or <a class="ulink" href=
          "http://www.citi.umich.edu/projects/nfsv4/linux/">libgssapi</a>,
          and <a class="ulink" href=
          "http://www.citi.umich.edu/projects/nfsv4/linux/">librpcsecgss</a>
          (for GSS and RPC security support) and <a class="xref" href=
          "../postlfs/libcap.html" title="libcap-2.31 with PAM">libcap-2.31
          with PAM</a>
        </p>
        <h4>
          Required (runtime)
        </h4>
        <p class="required">
          <a class="xref" href="rpcbind.html" title=
          "rpcbind-1.2.5">rpcbind-1.2.5</a>
        </p>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/nfs-utils">http://wiki.linuxfromscratch.org/blfs/wiki/nfs-utils</a>
        </p>
      </div>
      <div class="kernel" lang="en" xml:lang="en">
        <h2 class="sect2">
          <a id="nfs-utils-kernel" name="nfs-utils-kernel"></a>Kernel
          Configuration
        </h2>
        <p>
          Enable the following options in the kernel configuration (choose
          client and/or server support as appropriate) and recompile the
          kernel if necessary:
        </p>
        <pre class="screen">
<code class="literal">File systems  ---&gt;
  [*] Network File Systems  ---&gt;         [CONFIG_NETWORK_FILESYSTEMS]
    &lt;*/M&gt; NFS client support             [CONFIG_NFS_FS]
    &lt;*/M&gt; NFS server support             [CONFIG_NFSD]</code>
</pre>
        <p>
          Select the appropriate sub-options that appear when the above
          options are selected.
        </p>
        <div class="admon note">
          <img alt="[Note]" src="../images/note.png" />
          <h3>
            Note
          </h3>
          <p>
            In BLFS we assume that nfs v3 will be used. If the <span class=
            "emphasis"><em>server</em></span> offers nfs v4 (for linux,
            CONFIG_NFSD_V4) then auto-negotiation for v3 will fail and you
            will need to add <code class="literal">nfsver=3</code> to the
            mount options. This also applies if that option is enabled in the
            <span class="emphasis"><em>client's</em></span> kernel, for
            example in a distro trying to mount from a BLFS v3 server.
          </p>
          <p>
            Even if neither end of the connection supports nfs v4, adding
            <code class="literal">nfsver=3</code> is still beneficial because
            it prevents an error message "NFS: bad mount option value
            specified: minorversion=1" being logged on every mount.
          </p>
        </div>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          <a id="nfs-utils-install" name="nfs-utils-install"></a>Installation
          of NFS Utilities
        </h2>
        <p>
          Before you compile the program, ensure that the <code class=
          "systemitem">nobody</code> user and <code class=
          "systemitem">nogroup</code> group have been created as done in the
          current LFS book. You can add them by running the following
          commands as the <code class="systemitem">root</code> user:
        </p>
        <pre class="userinput">
<kbd class="command">groupadd -g 99 nogroup &amp;&amp;
useradd -c "Unprivileged Nobody" -d /dev/null -g nogroup \
    -s /bin/false -u 99 nobody</kbd>
</pre>
        <div class="admon note">
          <img alt="[Note]" src="../images/note.png" />
          <h3>
            Note
          </h3>
          <p>
            The classic uid and gid values are 65534 which is also -2 when
            interpreted as a signed 16-bit number. These values impact other
            files on some filesystems that do not have support for sparse
            files. The <code class="systemitem">nobody</code> and
            <code class="systemitem">nogroup</code> values are relatively
            arbitrary. The impact on a server is nil if the <code class=
            "filename">exports</code> file is configured correctly. If it is
            misconfigured, an <span class="command"><strong>ls
            -l</strong></span> or <span class=
            "command"><strong>ps</strong></span> listing will show a uid or
            gid number of 65534 instead of a name. The client uses
            <code class="systemitem">nobody</code> only as the user running
            <span class="command"><strong>rpc.statd</strong></span>.
          </p>
        </div>
        <p>
          Install <span class="application">NFS Utilities</span> by running
          the following commands:
        </p>
        <pre class="userinput">
<kbd class="command">./configure --prefix=/usr          \
            --sysconfdir=/etc      \
            --sbindir=/sbin        \
            --disable-nfsv4        \
            --disable-gss &amp;&amp;
make</kbd>
</pre>
        <p>
          This package does not come with a working test suite.
        </p>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make install                      &amp;&amp;
mv -v /sbin/start-statd /usr/sbin &amp;&amp;
chmod u+w,go+r /sbin/mount.nfs    &amp;&amp;
chown nobody.nogroup /var/lib/nfs</kbd>
</pre>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <em class="parameter"><code>--disable-nfsv4</code></em>: This
          allows the package to be built when libnfsidmap has not been
          installed.
        </p>
        <p>
          <em class="parameter"><code>--disable-gss</code></em>: Disables
          support for RPCSEC GSS (RPC Security).
        </p>
        <p>
          <span class="command"><strong>chown nobody.nogroup
          /var/lib/nfs</strong></span>: The rpc.statd program uses the
          ownership of this directory to set it's UID and GID. This command
          sets those to unprivileged entries.
        </p>
      </div>
      <div class="configuration" lang="en" xml:lang="en">
        <h2 class="sect2">
          Configuring NFS Utilities
        </h2>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="nfs-utils-server-config" name=
            "nfs-utils-server-config"></a>
          </h3>
          <h4 class="title">
            <a id="nfs-utils-server-config" name=
            "nfs-utils-server-config"></a>Server Configuration
          </h4>
          <p>
            <code class="filename">/etc/exports</code> contains the exported
            directories on NFS servers. Refer to the <code class=
            "filename">exports.5</code> manual page for the syntax of this
            file. Also refer to the "NFS HowTo" available at <a class="ulink"
            href=
            "http://nfs.sourceforge.net/nfs-howto/">http://nfs.sourceforge.net/nfs-howto/</a>
            for information on how to configure the servers and clients in a
            secure manner. For example, for sharing the <code class=
            "filename">/home</code> directory over the local network, the
            following line may be added:
          </p>
          <pre class="userinput">
<kbd class="command">cat &gt;&gt; /etc/exports &lt;&lt; EOF
<em class=
"replaceable"><code>/home 192.168.0.0/24</code></em>(rw,subtree_check,anonuid=99,anongid=99)
EOF</kbd>
</pre>
          <div class="admon note">
            <img alt="[Note]" src="../images/note.png" />
            <h3>
              Note
            </h3>
            <p>
              Be sure to replace the directory, network address. and prefix
              above to match your network. The only space in the line above
              should be between the directory and the network address.
            </p>
          </div>
          <div class="sect4">
            <div class="titlepage">
              <div>
                <div>
                  <h5 class="title">
                    <a id="nfs-utils-server-init" name=
                    "nfs-utils-server-init"></a><span class="phrase">Boot
                    Script</span>
                  </h5>
                </div>
              </div>
            </div>
            <p>
              Install the <span class="phrase"><code class=
              "filename">/etc/rc.d/init.d/nfs-server</code> init
              script</span> included in the <a class="xref" href=
              "../introduction/bootscripts.html" title=
              "BLFS Boot Scripts">blfs-bootscripts-20191204</a> package to
              start the server at boot.
            </p>
            <pre class="root">
<kbd class="command">make install-nfs-server</kbd>
</pre>
            <p>
              Now create the <code class=
              "filename">/etc/sysconfig/nfs-server</code> configuration file:
            </p>
            <pre class="root">
<kbd class="command">cat &gt; /etc/sysconfig/nfs-server &lt;&lt; "EOF"
<code class="literal">PORT="2049"
PROCESSES="8"
KILLDELAY="10"</code>
EOF</kbd>
</pre>
            <div class="admon note">
              <img alt="[Note]" src="../images/note.png" />
              <h3>
                Note
              </h3>
              <p>
                The above parameters may be optionally placed in <code class=
                "filename">/etc/sysconfig/rc.site</code>.
              </p>
            </div>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="nfs-utils-client-config" name=
            "nfs-utils-client-config"></a>
          </h3>
          <h4 class="title">
            <a id="nfs-utils-client-config" name=
            "nfs-utils-client-config"></a>Client Configuration
          </h4>
          <p>
            <code class="filename">/etc/fstab</code> contains the directories
            that are to be mounted on the client. Alternately the partitions
            can be mounted by using the <span class=
            "command"><strong>mount</strong></span> command with the proper
            options. To mount the <code class="filename">/home</code> and
            <code class="filename">/usr</code> partitions, add the following
            to the <code class="filename">/etc/fstab</code>:
          </p>
          <pre class="userinput">
<kbd class="command"><em class=
"replaceable"><code>&lt;server-name&gt;</code></em>:/home  /home nfs   rw,_netdev 0 0
<em class=
"replaceable"><code>&lt;server-name&gt;</code></em>:/usr   /usr  nfs   ro,_netdev 0 0</kbd>
</pre>
          <p>
            The options which can be used are specified in <span class=
            "command"><strong>man 5 nfs</strong></span>. If both the client
            and server are running recent versions of linux, most of the
            options will be negotiated (but see the Note above on nfsver=3).
            You can specify either <code class="literal">rw</code> or
            <code class="literal">ro</code>, <code class=
            "literal">_netdev</code> if the filesystem is to be automatically
            mounted at boot, or <code class="literal">noauto</code> (and
            perhaps <code class="literal">user</code>) for other filesystems.
          </p>
          <p>
            If the fileserver is not running a recent version of linux, you
            may need to specifiy other options.
          </p>
          <p>
            If you are using systemd, you may need to enable autofs v4 in
            your kernel, and add the option <code class=
            "literal">comment=systemd.automount</code>. Some machines need
            this, because systemd tries to mount the external fs's before the
            network is up, others do not need it. An alternative is for
            <code class="systemitem">root</code> to run <span class=
            "command"><strong>mount -a</strong></span>.
          </p>
          <div class="sect4">
            <div class="titlepage">
              <div>
                <div>
                  <h5 class="title">
                    <a id="nfs-utils-client-init" name=
                    "nfs-utils-client-init"></a><span class="phrase">Boot
                    Script</span>
                  </h5>
                </div>
              </div>
            </div>
            <div class="admon note">
              <img alt="[Note]" src="../images/note.png" />
              <h3>
                Note
              </h3>
              <p>
                The following <span class="phrase">boot script is</span> not
                required if the nfs-server <span class="phrase">script
                is</span> installed.
              </p>
            </div>
            <p>
              Install the <span class="phrase"><code class=
              "filename">/etc/rc.d/init.d/nfs-client</code> init
              script</span> included in the <a class="xref" href=
              "../introduction/bootscripts.html" title=
              "BLFS Boot Scripts">blfs-bootscripts-20191204</a> package to
              start the client services at boot.
            </p>
            <pre class="root">
<kbd class="command">make install-nfs-client</kbd>
</pre>
            <p>
              To automatically mount <code class="systemitem">nfs</code>
              filesystems, clients will also need to install the <code class=
              "filename">netfs</code> bootscript as described in <a class=
              "xref" href="netfs.html" title=
              "Configuring for Network Filesystems">Configuring for Network
              Filesystems</a>.
            </p>
          </div>
        </div>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">exportfs, mountstats, mount.nfs,
              mount.nfs4 (link to mount.nfs), nfsconf, nfsiostat, nfsstat,
              rpc.mountd, rpc.nfsd, rpc.statd, rpcdebug, showmount,
              sm-notify, start-statd, umount.nfs (link to mount.nfs), and
              umount.nfs4 (link to mount.nfs)</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Libraries:</strong>
              <span class="segbody">None</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/var/lib/nfs</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="exportfs" name="exportfs"></a><span class=
                    "term"><span class=
                    "command"><strong>exportfs</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    maintains a list of NFS exported file systems.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="mountstats" name="mountstats"></a><span class=
                    "term"><span class=
                    "command"><strong>mountstats</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    displays NFS client per-mount statistics.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="mount.nfs" name="mount.nfs"></a><span class=
                    "term"><span class=
                    "command"><strong>mount.nfs</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to mount a network share using NFS
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="mount.nfs4" name="mount.nfs4"></a><span class=
                    "term"><span class=
                    "command"><strong>mount.nfs4</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to mount a network share using NFSv4
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="nfsconf" name="nfsconf"></a><span class=
                    "term"><span class=
                    "command"><strong>nfsconf</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    can be used to test for and retrieve configuration
                    settings from a range of nfs-utils configuration files.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="nfsiostat-nfs-utils" name=
                    "nfsiostat-nfs-utils"></a><span class="term"><span class=
                    "command"><strong>nfsiostat</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    reports input/output statistics for network filesystems.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="nfsstat" name="nfsstat"></a><span class=
                    "term"><span class=
                    "command"><strong>nfsstat</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    displays statistics kept about NFS client and server
                    activity.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="rpc.mountd" name="rpc.mountd"></a><span class=
                    "term"><span class=
                    "command"><strong>rpc.mountd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    implements the NFS mount protocol on an NFS server.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="rpc.nfsd" name="rpc.nfsd"></a><span class=
                    "term"><span class=
                    "command"><strong>rpc.nfsd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    implements the user level part of the NFS service on the
                    server.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="rpc.statd" name="rpc.statd"></a><span class=
                    "term"><span class=
                    "command"><strong>rpc.statd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used by the NFS file locking service. Run on both
                    sides, client as well as server, when you want file
                    locking enabled.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="rpcdebug" name="rpcdebug"></a><span class=
                    "term"><span class=
                    "command"><strong>rpcdebug</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    sets or clears the kernel's NFS client and server debug
                    flags.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="showmount" name="showmount"></a><span class=
                    "term"><span class=
                    "command"><strong>showmount</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    displays mount information for an NFS server.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="sm-notify" name="sm-notify"></a><span class=
                    "term"><span class=
                    "command"><strong>sm-notify</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to send Network Status Monitor reboot messages.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="start-statd" name="start-statd"></a><span class=
                    "term"><span class=
                    "command"><strong>start-statd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a script called by nfsmount when mounting a filesystem
                    with locking enabled, if statd does not appear to be
                    running. It can be customised with whatever flags are
                    appropriate for the site.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="umount.nfs" name="umount.nfs"></a><span class=
                    "term"><span class=
                    "command"><strong>umount.nfs</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to unmount a network share using NFS
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="umount.nfs4" name="umount.nfs4"></a><span class=
                    "term"><span class=
                    "command"><strong>umount.nfs4</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to unmount a network share using NFSv4
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-02-14 17:40:08 -0800
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="net-tools.html" title=
          "Net-tools-CVS_20101030">Prev</a>
          <p>
            Net-tools-CVS_20101030
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="netfs.html" title=
          "Configuring for Network Filesystems">Next</a>
          <p>
            Configuring for Network Filesystems
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="netprogs.html" title=
          "Chapter&nbsp;15.&nbsp;Networking Programs">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
